package com.swyc.osschat.Test.StreamTest.Controller.Stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.apache.shiro.util.CollectionUtils;

import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.swyc.osschat.Test.LambdaTest.Bean.Pupil;
import com.swyc.osschat.Test.LambdaTest.Bean.Student;

/**
 * List 操作练习
 * @author zhaol@yunrong.cn
 * @version V2.1
 * @since 2.1.0 2019/8/9 18:17
 */
public class ListToListTest {
    public static void main(String[] args) {
        List<Student> students = Student.generateData();
        //todo 使用迭代器将一个list转换成另外一个list
        ArrayList<Pupil> pupils = Lists.newArrayList(Iterators.transform(students.iterator(), Pupil::studentConvertPupil));
        //todo list移除元素
        if (!CollectionUtils.isEmpty(pupils)) {
            pupils.forEach(existDo -> {
                students.removeIf(ee -> Objects.equals(existDo.getName(), ee.getName()));
            });
        }
        System.out.println("asdasdasda");
    }
}
